import { Component, OnInit, ViewChild, forwardRef, AfterViewChecked } from '@angular/core';
import { NG_VALUE_ACCESSOR, NG_VALIDATORS } from '@angular/forms';
import { Http } from '@angular/http';

import { CommonComponent } from '../../../../core/common/common.component';
import { CommonService } from '../../../../core/common/common.service';
import { TableDictService } from '../../../../core/common/table-dict.service';
import { SelectComponent } from '../../../../shared/component/ng2-select/select';
@Component({
  selector: 'ncloud-isp',
  templateUrl: './isp.component.html',
  styleUrls: ['./isp.component.scss'],
  providers: [
    { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => ISPComponent), multi: true },
    { provide: NG_VALIDATORS, useExisting: forwardRef(() => ISPComponent), multi: true }
  ]
})
export class ISPComponent extends CommonComponent implements OnInit, AfterViewChecked {
  @ViewChild('ispSelect') ispSelect: SelectComponent;
  @ViewChild('wanAccessTypeSelect') wanAccessTypeSelect: SelectComponent;
  @ViewChild('lanAccessTypeSelect') lanAccessTypeSelect: SelectComponent;
  public select: any = {};
  public lanDisabled = false;
  constructor(private commmon: CommonService, private http: Http, private tableDict: TableDictService) {
    super();
  }
  ngOnInit() {
    super.ngOnInit();
    this.initSelect();

  }
  ngAfterViewChecked(): void {

  }
  private initSelect(): void {
    this.tableDict.get('ACCESS_TYPE').subscribe((data: any) => {
      this.select.lanAccessType = data;
      this.lanDisabled = true;
    });
  }
  public lanAccessTypeSelected($event: any): void {

  }
}
